home *** CD-ROM | disk | FTP | other *** search
- /* Just linux Dyn DNS updater v2
- **
- **
- ** Requriments
- **
- ** rxsocket installede
- **
- **
- ** (C) 2000 Jacob Dahl Pind aka Rachael/Copy`n`Paste Tech.
- **
- **
- **
- **
- */
-
-
- /* config space */
-
- user="Foobar"
- password="FooPassword"
-
- /* host */
- host="Foobar.penguinpowered.com"
-
- /*
- **
- ** overrideip = 1 for overriding the automatical fetchede ip
- ** replace with 0 for using the fetchede ip
- **
- ** usefull if your machine is on a lan
- **
- **
- */
-
- overrideip="1"
- ip="213.237.16.246"
-
- /* don`t mess with the code below */
-
- defaultserver = "www.justlinux.com"
- urlprefix = "/bin/controlpanel/dyndns/jlc.pl?direct=1"
-
- call addlib("rxsocket.library",0,-30,0)
-
- if ~(overrideip) then do
- ip=GetHostID()
- end
-
- if ~Open("STDERR","CONSOLE:","W") then SDTERR="STDOUT"
-
- sin.addraddr=resolve(defaultserver)
- if sin.addraddr=-1 then call err "host <"host"> not found",1
- sin.addrport=80
-
- sock=socket("INET","STREAM")
- if sock=-1 then call err "can't create socket"
- if connect(sock,"SIN")<0 then call err "can't connect"
-
- fin="D0A"x
- request="GET" space(urlprefix'&username='user'&password='password'&host='host'&ip='ip) "HTTP/1.0"fin
- request=request||fin
-
- say "sending request..."
- if send(sock,request)<0 then call err "error sending"
-
- say "receiving results..."
- if recvline(sock,"BUF",256)<0 then call err "error receiving"
- if buf="" then call err "empty answer",1
- parse var buf http code
- if word(code,1)~=200 then call err "error from server" code,1
-
- say "receiving head..."
- do while buf~="D0A"x
- if recvline(sock,"BUF",256)<0 then call err "error receiving"
- end
-
- say "receiving file..."
- res=recv(sock,"BUF",256)
- do while res>0
- call writech("STDOUT",buf)
- res=recv(sock,"BUF",256)
- end
- if res<0 then call err "error receiving"
- say "done."
- exit
-
- /* error handling procedure */
- err: Procedure Expose socket
- parse arg msg
- If IsLibOn('SOCKET') Then If errno() == 4 Then msg = 'timeout'
- Say 'jldyndns :' msg
- Exit
-